export {};
let array1: number[] = [1, 2, 4, 45, 6];
let target: number = 3;
function twoSum1(arr: number[], target: number): any {
  let hash = {};

  for (let i = 0; i < arr.length; i++) {
    const rest = target - arr[i];
    if (hash[rest]) {
      return [i, hash[rest]];
    } else {
      hash[rest] = i;
    }
  }
  return false;
}

twoSum1(array1, target);
